﻿using System;
using System.Collections.Generic;
using System.Data;

namespace EnterpriseFramework.DataAccess
{
    public class Parameter : IParameter
    {
        private string parameterName = string.Empty;

        public string ParameterName
        {
            get { return parameterName; }
            set { parameterName = value; }
        }

        private DbType dbType = DbType.Object;

        public DbType DbType
        {
            get { return dbType; }
            set { dbType = value; }
        }
        private ParameterDirection direction = ParameterDirection.Input;

        public ParameterDirection Direction
        {
            get { return direction; }
            set { direction = value; }
        }

        private int size = 0;

        public int Size
        {
            get { return size; }
            set { size = value; }
        }

        private object value = null;

        public object Value
        {
            get { return this.value; }
            set { this.value = value; }
        }

        private string propertyName;
        public string PropertyName
        {
            get { return propertyName; }
            set { propertyName = value; }
        }

        public Parameter() { }

        public Parameter(string propertyName, object value)
        {
            useFillParameter = true;
            this.propertyName = propertyName;
            this.value = value;
        }

        private bool useFillParameter = false;
        public bool UseFillParameter
        {
            get { return useFillParameter; }
        }

        public Parameter(DbType dbType, object value)
        {
            this.dbType = dbType;
            this.value = value;
        }

        public Parameter(string parameterName, DbType dbType, object value)
            : this(dbType, value)
        {
            this.parameterName = parameterName;
            this.dbType = dbType;
            this.value = value;
        }

        public Parameter(string parameterName, DbType dbType, object value, int size)
            : this(parameterName, dbType, value)
        {
            this.size = size;
        }

        public Parameter(string parameterName, DbType dbType, object value, ParameterDirection direction)
            : this(parameterName, dbType, value)
        {
            this.direction = direction;
        }

        public Parameter(string parameterName, DbType dbType, object value, ParameterDirection direction, int size)
            : this(parameterName, dbType, value)
        {
            this.direction = direction;
            this.size = size;
        }
    }
}
